﻿using System;

namespace SanlieHash
{
    using SanlieHash.BlockCipher;
    using SanlieHash.Fast;

    public class FastAES
    {
        public static string Encrypt(string input, string pass)
        {
            if (string.IsNullOrEmpty(input)) return string.Empty;
            return Helper.ToHexString(AES.EncryptBytes(pass, System.Text.Encoding.UTF8.GetBytes(input)));
        }
        public static string Encrypt2Base64(string input, string pass)
        {
            if (string.IsNullOrEmpty(input)) return string.Empty;
            return FastEncode.Base64Encode(AES.EncryptBytes(pass, System.Text.Encoding.UTF8.GetBytes(input)));
        }
        public static string Decrypt(string input, string pass)
        {
            if (string.IsNullOrEmpty(input)) return string.Empty;
            return System.Text.Encoding.UTF8.GetString(AES.DecryptBytes(pass, Helper.ToBytes(input)));
        }
        public static string Decrypt(byte[] input, string pass)
        {
            return System.Text.Encoding.UTF8.GetString(AES.DecryptBytes(pass, input));
        }
    }
}
